

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>添加单位</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="../../../layuiadmin/style/admin.css" media="all">
</head>
<body>

<div class="layui-fluid">
  <div class="layui-row layui-col-space15">
    <div class="layui-col-md12">
      <div class="layui-card">
        <div class="layui-card-header">/添加单位</div>
        <div class="layui-card-body" pad15>
          <form action="/company/" method="post" enctype="application/json">
            <div class="layui-form" wid100 lay-filter="demo2">
              <div class="layui-form-item">
                <label class="layui-form-label">单位名称:</label>
                <div class="layui-input-block">
                  <input type="text" name="name" value="" class="layui-input">
                </div>
              </div>
              <div class="layui-form-item">
                <label class="layui-form-label">营业执照名称:</label>
                <div class="layui-input-block">
                  <input type="text" name="zhiZhao"  value="" class="layui-input">
                </div>
              </div>
              <div class="layui-form-item">
                <label class="layui-form-label">所在城市:</label>
                <div class="layui-input-inline" style="width: 80px;">
                  <div class="layui-col-md6">
                    <select   name="provinceId" lay-verify="">
                      <option value="">请选择一个省</option>
                      <option value="410000">河南省</option>
                      <option value="320000">江苏省</option>
                      <option value="330000">浙江省</option>
                    </select>
                    <select  name="cityId" lay-verify="">
                      <option value="">请选择一个城市</option>
                      <option value="410100">郑州市</option>
                      <option value="410200">开封市</option>
                      <option value="410300">洛阳市</option>
                    </select>
                  </div>
                </div>
              </div>
              <div class="layui-form-item">
                <label class="layui-form-label">单位性质:</label>
                <div class="layui-input-inline" style="width: 80px;">
                  <div class="layui-col-md12">
                    <input type="radio" name="companyType" value="0" title="学校">
                    <input type="radio" name="companyType" value="1" title="机构" checked>
                  </div>
                </div>
              </div>
              <div class="layui-form-item">
                <label class="layui-form-label">有效标志</label>
                <div class="layui-input-inline" style="width: 80px;">
                  <div class="layui-col-md12">
                    <input type="radio" name="status" value="true" title="有效">
                    <input type="radio" name="status" value="false" title="无效" checked>
                  </div>
                </div>
              </div>
              <div class="layui-form-item">
                <div class="layui-input-block">
                  <button class="layui-btn" lay-submit lay-filter="demo1">确认保存</button>
                </div>
              </div>
            </div>
          </form>
        </div>
      </div>
    </div>
  </div>
</div>

<script src="../../../layuiadmin/layui/layui.js"></script>

<script src="../../../layuiadmin/layui/lay/modules/form.js"></script>
<!--<script src="../../../layuiadmin/layui/layui.all.js"></script>-->
<script>
  layui.config({
    base: '../../../layuiadmin/' //静态资源所在路径
  }).extend({
    index: 'lib/index' //主入口模块
  }).use(['index', 'set']);


  //引用jquery
  // layui.use(['jquery', 'layer'], function(){
  //   var $ = layui.$ //重点处
  //           ,layer = layui.layer;
  //
  //   //后面就跟你平时使用jQuery一样
  //   $('body').append('hello jquery');
  // });
  layui.use(['jquery','form'],function(){
    var form = layui.form;
    var $ = layui.$;
    form.on('submit(demo1)', function(data){
      $.ajax(
              {
                type:'post',
                url:'/company/',
                contentType:'application/json;charset=utf-8',
                data:JSON.stringify(data.field),
                dataType:'json',
                success:function (result,status,xhr){
                  alert("添加成功");
                }

              }
      );
    return false;
  });})

</script>
</body>
</html>